package internal

import (
	"base"
	"gate_server/chanrpc"
	. "gate_server/internal"
	"gate_server/logic"
	"leaf/gate"
)

type Module struct {
	*gate.Server
}

func (m *Module) OnPrepare() {
	server := new(gate.Server)
	server.MaxConnNum = Config.MaxConnNum
	server.PendingWriteNum = PendingWriteNum
	server.MaxMsgLen = MaxMsgLen
	server.Processor = base.Processor

	server.TCPAddr = Config.InternalAddr
	server.LenMsgLen = LenMsgLen
	server.LittleEndian = base.LittleEndian
	server.NewTcpAgent = chanrpc.NewGameAgent
	server.CloseTcpAgent = chanrpc.CloseGameAgent

	m.Server = server
}

func (m *Module) OnInit() {
	m.Server.AgentChanRPC = logic.ChanRpc
}
